<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of jitterImage</title>
  <meta name="keywords" content="jitterImage">
  <meta name="description" content="Creates multiple, slightly jittered versions of an image.">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html &copy; 2003 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../m2html.css">
</head>
<body>
<a name="_top"></a>
<!-- menu.html images -->
<h1>jitterImage
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>Creates multiple, slightly jittered versions of an image.</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function IJ = jitterImage( I, varargin ) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment"> Creates multiple, slightly jittered versions of an image.

 Takes an image I, and generates a number of images that are copies of the
 original image with slight translation, rotation and scaling applied. If
 the input image is actually an MxNxK stack of images then applies op to
 each image. Rotations and translations are specified by giving a range
 and a max value for each. For example, if mPhi=10 and nPhi=5, then the
 actual rotations applied are linspace(-mPhi,mPhi,nPhi)=[-10 -5 0 5 10].
 Likewise if mTrn=3 and nTrn=3 then the translations are [-3 0 3]. Each
 tran is applied in the x direction as well as the y direction. Each
 combination of rotation, tran in x, tran in y and scale is used (for
 example phi=5, transx=-3, transy=0), so the total number of images
 generated is R=nTrn*nTrn*nPhi*nScl. Finally, jsiz controls the size of
 the cropped images. If jsiz gives a size that's sufficiently smaller than
 I then all data in the the final set will come from I. Otherwise, I must
 be padded first (by calling padarray with the 'replicate' option).

 USAGE
  function IJ = jitterImage( I, varargin )

 INPUTS
  I          - image (MxN) or set of K images (MxNxK)
  varargin   - additional params (struct or name/value pairs)
   .maxn        - [inf] maximum jitters to generate (prior to flip)
   .nPhi        - [0] number of rotations
   .mPhi        - [0] max value for rotation
   .nTrn        - [0] number of translations
   .mTrn        - [0] max value for translation
   .flip        - [0] if true then also adds reflection of each image
   .jsiz        - [] Final size of each image in IJ
   .scls        - [1 1] nScl x 2 array of vert/horiz scalings
   .method      - ['linear'] interpolation method for imtransform2
   .hasChn      - [0] if true I is MxNxC or MxNxCxK

 OUTPUTS
  IJ          - MxNxKxR or MxNxCxKxR set of images, R=(nTrn^2*nPhi*nScl)

 EXAMPLE
  load trees; I=imresize(ind2gray(X,map),[41 41]); clear X caption map
  % creates 10 (of 7^2*2) images of slight trans
  IJ = jitterImage(I,'nTrn',7,'mTrn',3,'maxn',10); montage2(IJ)
  % creates 5 images of slight rotations w reflection
  IJ = jitterImage(I,'nPhi',5,'mPhi',25,'flip',1); montage2(IJ)
  % creates 45 images of both rot and slight trans
  IJ = jitterImage(I,'nPhi',5,'mPhi',10,'nTrn',3,'mTrn',2); montage2(IJ)
  % additionally create multiple scaled versions
  IJ = jitterImage(I,'scls',[1 1; 2 1; 1 2; 2 2]); montage2(IJ)
  % example on color image (5 images of slight rotations)
  I=imResample(imread('peppers.png'),[100,100]);
  IJ=jitterImage(I,'nPhi',5,'mPhi',25,'hasChn',1);
  montage2(uint8(IJ),{'hasChn',1})

 See also <a href="imtransform2.html" class="code" title="function J = imtransform2( I, H, varargin )">imtransform2</a>

 Piotr's Computer Vision Matlab Toolbox      Version 2.65
 Copyright 2014 Piotr Dollar.  [pdollar-at-gmail.com]
 Licensed under the Simplified BSD License [see external/bsd.txt]</pre></div>





<!-- Start of Google Analytics Code -->
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-4884268-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>
<!-- end of Google Analytics Code -->

<hr><address>Generated by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" target="_parent">m2html</a></strong> &copy; 2003</address>
</body>
</html>
